<?php
	################################################
	#   GENERATION DES OBJETS COMPLEXES CREES 	   #
	################################################
	header("Expires: -1");
	header("Content-type: text/html; charset=iso-8859-1");
	require_once "../db/mysql/tbr.php";
	require_once "../classes/forms.cls.php";
	require_once "../conf/config.php";
	
	
	/****  CONNECTION TO RDBMS SERVER ****/	
	require_once "../db/mysql/tbr.ini.php";
	/***********************************/
	
	
	$form = new svq_form();
	$formTable = 'svq_cplx';
	$lineTable = 'svq_cplxline';
	$formLineTable = 'svq_cplx_line';
	$__ = $form->collectCplxObj($base,$formTable,$lineTable,$formLineTable);
	$RES='';$RES2='';$BEG='<tr>';$MID='';$END='</tr>';$MAX_PER_LINE=2;$cpt=1;$inc=1;$BREAK='<tr>'; for($i=0;$i<$MAX_PER_LINE;$i++){$BREAK.='<td><td>';}$BREAK.='</tr>';$BREAK.=$BREAK.$BREAK;	
	$table ="<table id='cplxGen' style='width:98%;border-collapse:no-collapse;'>";
		foreach($__ as $cplx){
			///////////////////////////
			$RES2.=($inc===1)?$cplx:'#'.$cplx;
			///////////////////////////
		
			if(count($__)===1){
				$MID='<td id="cplxFactoSup'.$inc.'">';
				$MID.=$cplx;     
				$MID.='</td>';
				$MID.='<td>&nbsp;</td>';
				$RES.=$BEG;
				$RES.=$MID;
				$RES.=$END;
			}else{
				$MID='<td id="cplxFactoSup'.$inc.'" class="ui-widget-content ui-corner-bottom ui-corner-top ui-state-default">';
				$MID.=$cplx;
				$MID.='</td>';
				$MID.='<td>&nbsp;</td>';
				
				if($cpt==1){
					$RES.=$BEG;
				}
				if($cpt<$MAX_PER_LINE){
					$RES.=$MID;
				}
				if($cpt==$MAX_PER_LINE){
					$RES.=$MID.$END.$BREAK;								
					$cpt=0;
				}				
				
				$cpt++;
				$inc++;
			}						
		}
	$table.=$RES;
	$table.="<table>";
	echo $RES2;
	
	
?>